home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ifl / libpbm.z / libpbm
Encoding:
Text File  |  1998-10-20  |  8.5 KB  |  199 lines

  1.  
  2.  
  3.  
  4. lllliiiibbbbppppbbbbmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppbbbbmmmm((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      libpbm - functions to support portable bitmap programs
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      #include <pbm.h>
  13.      cc ... libpbm.a
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN ---- PPPPAAAACCCCKKKKAAAAGGGGEEEE----WWWWIIIIDDDDEEEE RRRROOOOUUUUTTTTIIIINNNNEEEESSSS
  17.    KKKKEEEEYYYYWWWWOOOORRRRDDDD MMMMAAAATTTTCCCCHHHHIIIINNNNGGGG
  18.      int pm_keymatch( char* str, char* keyword, int minchars )
  19.  
  20.      Does a case-insensitive match of ssssttttrrrr against kkkkeeeeyyyywwwwoooorrrrdddd.  ssssttttrrrr can be a
  21.      leading sunstring of kkkkeeeeyyyywwwwoooorrrrdddd, but at least mmmmiiiinnnncccchhhhaaaarrrrssss must be present.
  22.  
  23.    LLLLOOOOGGGG BBBBAAAASSSSEEEE TTTTWWWWOOOO
  24.      int pm_maxvaltobits( int maxval )
  25.      int pm_bitstomaxval( int bits )
  26.  
  27.      Convert between a maxval and the minimum number of bits required to hold
  28.      it.
  29.  
  30.    MMMMEEEESSSSSSSSAAAAGGGGEEEESSSS AAAANNNNDDDD EEEERRRRRRRROOOORRRRSSSS
  31.      void pm_message( char* fmt, ... )
  32.  
  33.      pppprrrriiiinnnnttttffff(((()))) style routine to write an informational message.
  34.  
  35.      void pm_error( char* fmt, ... )
  36.  
  37.      pppprrrriiiinnnnttttffff(((()))) style routine to write an error message and abort.
  38.  
  39.      void pm_usage( char* usage )
  40.  
  41.      Write a usage message.  The string should indicate what arguments are to
  42.      be provided to the program.
  43.  
  44.    GGGGEEEENNNNEEEERRRRIIIICCCC FFFFIIIILLLLEEEE MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  45.      FILE* pm_openr( char* name )
  46.  
  47.      Open the given file for reading, with appropriate error checking.  A
  48.      filename of "-" is taken as equivalent to stdin.
  49.  
  50.      FILE* pm_openw( char* name )
  51.  
  52.      Open the given file for writing, with appropriate error checking.
  53.  
  54.      void pm_close( FILE* fp )
  55.  
  56.      Close the file descriptor, with appropriate error checking.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. lllliiiibbbbppppbbbbmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppbbbbmmmm((((3333))))
  71.  
  72.  
  73.  
  74.    EEEENNNNDDDDIIIIAAAANNNN IIII////OOOO
  75.      int pm_readbigshort( FILE* in, short* sP )
  76.      int pm_writebigshort( FILE* out, short s )
  77.      int pm_readbiglong( FILE* in, long* lP )
  78.      int pm_writebiglong( FILE* out, long l )
  79.      int pm_readlittleshort( FILE* in, short* sP )
  80.      int pm_writelittleshort( FILE* out, short s )
  81.      int pm_readlittlelong( FILE* in, long* lP )
  82.      int pm_writelittlelong( FILE* out, long l )
  83.  
  84.      Routines to read and write short and long ints in either big- or little-
  85.      endian byte order.
  86.  
  87. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN ---- PPPPBBBBMMMM----SSSSPPPPEEEECCCCIIIIFFFFIIIICCCC RRRROOOOUUUUTTTTIIIINNNNEEEESSSS
  88.    TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  89.      typedef ... bit;
  90.      #define PBM_WHITE ...
  91.      #define PBM_BLACK ...
  92.  
  93.      each bbbbiiiitttt should contain only the values of PPPPBBBBMMMM____WWWWHHHHIIIITTTTEEEE or PPPPBBBBMMMM____BBBBLLLLAAAACCCCKKKK.
  94.  
  95.      #define PBM_FORMAT ...
  96.      #define RPBM_FORMAT ...
  97.      #define PBM_TYPE PBM_FORMAT
  98.      #define PBM_FORMAT_TYPE(f) ...
  99.  
  100.      For distinguishing different file formats and types.
  101.  
  102.    IIIINNNNIIIITTTTIIIIAAAALLLLIIIIZZZZAAAATTTTIIIIOOOONNNN
  103.      void pbm_init( int* argcP, char* argv[] )
  104.  
  105.      All PBM programs must call this routine.
  106.  
  107.    MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  108.      bit** pbm_allocarray( int cols, int rows )
  109.  
  110.      Allocate an array of bits.
  111.  
  112.      bit* pbm_allocrow( int cols )
  113.  
  114.      Allocate a row of the given number of bits.
  115.  
  116.      void pbm_freearray( bit** bits, int rows )
  117.  
  118.      Free the array allocated with ppppbbbbmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing the given
  119.      number of rows.
  120.  
  121.      void pbm_freerow( bit* bitrow )
  122.  
  123.      Free a row of bits.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. lllliiiibbbbppppbbbbmmmm((((3333))))         IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          lllliiiibbbbppppbbbbmmmm((((3333))))
  137.  
  138.  
  139.  
  140.    RRRREEEEAAAADDDDIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  141.      void pbm_readpbminit( FILE* fp, int* colsP, int* rowsP, int* formatP )
  142.  
  143.      Read the header from a PBM file, filling in the rows, cols and format
  144.      variables.
  145.  
  146.      void pbm_readpbmrow( FILE* fp, bit* bitrow, int cols, int format )
  147.  
  148.      Read a row of bits into the bitrow array.  Format and cols were filled in
  149.      by ppppbbbbmmmm____rrrreeeeaaaaddddppppbbbbmmmmiiiinnnniiiitttt(((()))).
  150.  
  151.      bit** pbm_readpbm( FILE* fp, int* colsP, int* rowsP )
  152.  
  153.      Read an entire bitmap file into memory, returning the allocated array and
  154.      filling in the rows and cols variables.  This function combines
  155.      ppppbbbbmmmm____rrrreeeeaaaaddddppppbbbbmmmmiiiinnnniiiitttt(((()))), ppppbbbbmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppbbbbmmmm____rrrreeeeaaaaddddppppbbbbmmmmrrrroooowwww(((()))).
  156.  
  157.      char* pm_read_unknown_size( FILE* fp, long* nread )
  158.  
  159.      Read an entire file or input stream of unknown size to a buffer.
  160.      Allocate memory more memory as needed. The calling routine has to free
  161.      the allocated buffer with ffffrrrreeeeeeee(((()))).  ppppmmmm____rrrreeeeaaaadddd____uuuunnnnkkkknnnnoooowwwwnnnn____ssssiiiizzzzeeee(((()))) returns a
  162.      pointer to the allocated buffer. The nnnnrrrreeeeaaaadddd argument returns the number of
  163.      bytes read.
  164.  
  165.    WWWWRRRRIIIITTTTIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  166.      void pbm_writepbminit( FILE* fp, int cols, int rows, int forceplain )
  167.  
  168.      Write the header for a portable bitmap file.  The forceplain flag forces
  169.      a plain-format file to be written, as opposed to a raw-format one.
  170.  
  171.      void pbm_writepbmrow( FILE* fp, bit* bitrow, int cols, int forceplain )
  172.  
  173.      Write a row from a portable bitmap.
  174.  
  175.      void pbm_writepbm( FILE* fp, bit** bits, int cols, int rows, int forceplain )
  176.  
  177.      Write the header and all data for a portable bitmap.  This function
  178.      combines ppppbbbbmmmm____wwwwrrrriiiitttteeeeppppbbbbmmmmiiiinnnniiiitttt(((()))) and ppppbbbbmmmm____wwwwrrrriiiitttteeeeppppbbbbmmmmrrrroooowwww(((()))).
  179.  
  180. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  181.      libpgm(3), libppm(3), libpnm(3)
  182.  
  183. AAAAUUUUTTTTHHHHOOOORRRR
  184.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.